const path = require('path')
const {
    CleanWebpackPlugin
} = require('clean-webpack-plugin') // webpack插件 清除打包文件夹下多余文件 
const HtmlWebpackPlugin = require('html-webpack-plugin') // webpack插件    简化html创建 
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
    entry: './src/main.js',
    output: {
        filename: 'js/bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [{
                test: /\.(css|less)$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'less-loader'
                ]
            },
         
            {
                test: /\.vue$/,
                use: [
                    'vue-loader',
                ]
            },
            {
                test: /\.png$/,
                use: {
                    loader: 'file-loader',
                    options: {
                        outputPath: 'img',
                        name: '[name].[ext]'
                    }
                }
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './public/index.html',
            filename: "index.html" //设置内存中页面名称
        }),
        new VueLoaderPlugin(),

    ]
}